# built in python 3.5.2
# 作者：陈常鸿
# 02 矩阵运算
import numpy as np
from numpy.linalg import inv
n=np.array(range(1,5)).reshape(2,2)
print(n)
print(np.transpose(n))
print(n+n)
print(n-n)
print(3*n)
print(n.dot(n))               # np.dot(n,n)是一样的效果
print(inv(n))
print(np.dot(inv(n),n))
# 转置
a=np.array([[1,0,0],[0,1,1],[1,1,0]])
b=np.array([1,1,1])
print(np.dot(a.T,b))